#ifndef _sbrush_audio_manager_h_
#define _sbrush_audio_manager_h_

#include <string>
#include "sbrush_errors.h"
namespace sbrush {
	
	class AudioManagerError : public AcsError {
	public:
		AudioManagerError(const std::string& msg);
		virtual ~AudioManagerError() throw();
	private:
	};
	
	class PortAudioError : public AudioManagerError {
	public:
		PortAudioError(int errorCode);
		virtual ~PortAudioError() throw();
		int code() const;
	private:
		int m_Code;
	};
	
	class AudioSource {
	public:
		AudioSource();
		virtual ~AudioSource() throw();
		virtual void addAudio(float** buffer, 
							  size_t numFrames, 
							  size_t numChannels) = 0; 
	};
	
	class AudioManager {
	public:
		static void init();
		static void start(size_t numInputs, 
						  size_t numOutputs, 
						  double sampleRate, 
						  size_t frameSize,
						  int device = -1);
		static void stop();
		static void addSource(AudioSource* source);
		static void removeSource(AudioSource* source);
		static size_t getNumInputs();
		static size_t getNumOutputs();
		static double getSampleRate();
		static size_t getNumDevices();
		static const char* getDeviceName(int device);
		static int getMaxInputChannels(int device);
		static int getMaxOutputChannels(int device);
		static double getDefaultSampleRate(int device);
		static void makeNoiseAndLog(float** buffer, 
									size_t numChannels, 
									size_t numFrames);
		static void logAudio(float** buffer, 
							 size_t numChannels, 
							 size_t numFrames);

	};
}



#endif